package com.cdplife.ci.modular.system.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.cdplife.ci.modular.system.model.PlanInsuranceKind;
import com.cdplife.ci.modular.system.dao.PlanInsuranceKindMapper;
import com.cdplife.ci.modular.system.service.IPlanInsuranceKindService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 计划险种表 服务实现类
 * </p>
 *
 * @author jers
 * @since 2018-11-11
 */
@Service
public class PlanInsuranceKindServiceImpl extends ServiceImpl<PlanInsuranceKindMapper, PlanInsuranceKind> implements IPlanInsuranceKindService {
    /**
     * 获取保单计划已有的险种列表
     */
    public List<PlanInsuranceKind> getPlanInsuranceKindList(Integer planId, Integer planType){
        Wrapper<PlanInsuranceKind> wrapper = new EntityWrapper<PlanInsuranceKind>();
        wrapper = wrapper.eq("plan_id",planId).and().eq("plan_type",planType);
        return this.baseMapper.selectList(wrapper);
    }

    /**
     * 批量获取险种名称
     */
    public List<Map<String, Object>> getInsuranceNameByBatchIds(List<Long> planIds,Integer planType){
        return this.baseMapper.getInsuranceNameByBatchIds(planIds,planType);
    }
    /**
     * 通过计划ID批量获取险种信息
     */
    public List<Map<String, Object>> getInsuranceListByBatchIds(Long planId,Integer planType){
        return this.baseMapper.getInsuranceListByBatchIds(planId,planType);
    }
}
